﻿using SBlogCore.Common.FluentValidatorExtend;

namespace SBlogCore.Application.Demo.Dto
{
    /// <summary>
    /// 测试Dto
    /// </summary>
    public class DemoInput
    {
        /// <summary>
        /// 
        /// </summary>
        public string? Name { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int Age { get; set; }
    }
    /// <summary>
    /// 校验类
    /// </summary>
    public class DemoInputValidator : SblogCoreAbstractValidator<DemoInput>
    {
        /// <summary>
        /// 
        /// </summary>
        public DemoInputValidator()
        {
            RuleFor(x => x.Name).NotNull().WithMessage("名称不能为空");
            RuleFor(x => x.Age).Must(m=>m<100).WithMessage("年龄不能超过100岁");
        }
    }
}
